<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        html,body {
            height: 100%;
            overflow: hidden;
            background: black;
            text-align: center;
        }
        h1 {
            margin-top: 50px;
            display: inline-block;
            color: rgba(128,128,128,.3);
            font: bold 80px '微软雅黑';
            background: linear-gradient(135deg,
            rgba(255, 255, 255, 0) 20px,
            rgba(255, 255, 255, 1) 50px,
            rgba(255, 255, 255, 0) 100px) no-repeat;
            -webkit-background-clip: text;
            /*transition: 3s;*/
        }
        /*h1:hover {*/
        /*    background-position: 350px 0;*/
        /*}*/
    </style>
</head>
<body>
    <h1>光斑动画</h1>
</body>
<script>
    var h1 = document.querySelector('h1')
    var flag = 0
    setInterval(function () {
        flag+=10
        if(flag === 350) {
            flag = 0
        }
        h1.style.backgroundPosition = flag+'px'
    }, 50)
</script>
</html>
